package com.xwyzsn.food.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xwyzsn.food.entity.Restaurant;
import com.xwyzsn.food.mapper.RestaurantMapper;
import com.xwyzsn.food.service.RestaurantService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xwyzsn.food.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author scorpios
 * @since 2024-03-13
 */
@Service
public class RestaurantServiceImpl extends ServiceImpl<RestaurantMapper, Restaurant> implements RestaurantService {

    @Autowired
    private RestaurantMapper mapper;

    public List<Restaurant> get(Map<String,?> map){
        QueryWrapper<Restaurant> wrapper = new QueryWrapper<>();
        if(map.isEmpty()){
            return mapper.selectList(wrapper);
        }
        Integer id = Integer.parseInt(String.valueOf(map.get("id")));
        wrapper.eq("id",id);
        return mapper.selectList(wrapper);
    }

}
